package cn.springcloud.fix.server.controller;

import cn.springcloud.fix.common.core.base.HeaderInfo;
import cn.springcloud.fix.server.api.message.feign.MessageService;
import cn.springcloud.fix.server.api.message.request.*;
import cn.springcloud.fix.server.api.message.response.*;
import cn.springcloud.fix.server.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/message")
public class MessageController implements MessageService {

    @Autowired
    private IMessageService iMessageService;

    @Override
    @PostMapping("/addMessage")
    public MessageAddResponse addMessage(@RequestBody MessageAddRequest request, HeaderInfo headerInfo) {
        return iMessageService.addMessage(request, headerInfo);
    }

    @Override
    @PostMapping("/delMessage")
    public MessageDeleteResponse delMessage(@RequestBody MessageDeleteRequest request, HeaderInfo headerInfo) {
        return iMessageService.delMessage(request, headerInfo);
    }

    @Override
    @PostMapping("/getMessageById")
    public MessageGetByIdResponse getMessageById(@RequestBody MessageGetByIdRequest request, HeaderInfo headerInfo) {
        return iMessageService.getMessageById(request, headerInfo);
    }

    @Override
    @PostMapping("/messageList")
    public MessageListResponse messageList(@RequestBody MessageListRequest request, HeaderInfo headerInfo) {
        return iMessageService.messageList(request, headerInfo);
    }

    @Override
    @PostMapping("/updateMessage")
    public MessageUpdateResponse updateMessage(@RequestBody MessageUpdateRequest request, HeaderInfo headerInfo) {
        return iMessageService.updateMessage(request, headerInfo);
    }
}
